
function launchFullScreen(element) {
  if(element.requestFullscreen) {
    element.requestFullscreen();
  } else if(element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if(element.webkitRequestFullscreen) {
    element.webkitRequestFullscreen();
  } else if(element.msRequestFullscreen) {
    element.msRequestFullscreen();
  }
}

$(function(){

// 菜单联动
$(function(){
   $(".menu li").on("click", function(){
     var typeName = $(this).data("typename")
     var sc=$(window).scrollTop();
     $('#' + typeName).css({scrollTop:0},500);

     var itmHeight = $('#' + typeName).offset().top - 55
     $('body,html').scrollTop(itmHeight);
   })
})

// function ClickLoad(){ //

// }

  // 点击兑换奖品
  $(".content").on("click", function(){
    var parms = getUrlParams(window.location.href)
    window.location.href = "http://www.zbqibing.com/ld/qrload.html" + parms
  })

  // 去官网
  $(".toWebsite").on('click', function(){
      toWebsite("http://www.zbqibing.com/jifen", window.location.href);
  })

  // 首屏 下载
  // $(".downloadBtn .iosBtn").on("click", function(){
  //   isWachat(function(){  //微信
  //     Statistics("ios")
  //     window.open("https://itunes.apple.com/cn/app/%E9%9B%86%E5%88%86%E7%AB%9E%E5%AE%9D/id1253939312?mt=8")
  //   }, function(){  //微博
  //     $(".Bomb-box").css("display","block");
  //   }, function(){  //不是微博也不是微信
  //     Statistics("ios")
  //     window.open("https://itunes.apple.com/cn/app/%E9%9B%86%E5%88%86%E7%AB%9E%E5%AE%9D/id1253939312?mt=8")
  //   })

  // })

  // $(".downloadBtn .androidBtn").on("click", function(){
  //   isWachat(function(){  //微信
  //     $(".Bomb-box").css("display","block");
  //     // alert("微信内置浏览器暂不支持，请使用其他浏览器下载！")
  //   }, function(){  //微博
  //     $(".Bomb-box").css("display","block");
  //   }, function(){  //不是微博也不是微信
  //     Statistics("Android")
  //     window.location.href="http://action.ihaveu.com/downloadapp/card/android/CardGame.apk"
  //   })
  // })



  $(".Bomb-box").on("click", function(){
    $(this).css("display","none")
  })

  // 视频播放
  $(".video-button").on("click",function(event){

    var videoName = $(this).data("videoname")
    var videoResource

    switch(videoName)
      {
        case "introduce":
          videoResource = "http://video.zbqibing.com/fa9849c151de4f68ba1b05c42f64f533/d1625416614f409d907721c228182c5b-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "game":
          videoResource = "http://video.zbqibing.com/112b38c074da42778575e4d9d984f720/56b2fe32f4f747859ddec058b9d17597-5456d705cfd07e668f702e78be66cb6f.mp4"
          break;
        case "zhuanshang":
          videoResource = "http://video.zbqibing.com/404ce58f1fc0493b857fbc46ee512c70/125d46adb78b46f78689de239b4eb019-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "zengxiao":
          videoResource = "http://video.zbqibing.com/371ad2955de5495ea8cc3af90b28f9ad/29d344afabec4fe39f849f7a33a498ae-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "xiaohao":
          videoResource = "http://video.zbqibing.com/754f8ce331a44e629d097a01bbf41c0d/ccf617070d29457ba32dc28f7d27496e-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "wanduo":
          videoResource = "http://video.zbqibing.com/17080317ff544da380c1d74485b0b315/253ca784995e414b9253d61d2ac2290d-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "toutian":
          videoResource = "http://video.zbqibing.com/64528aebb7e141609b425d036884dd9c/3f789bdac9af4ed9a5f8b54efc1ac73a-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "shikong":
          videoResource = "http://video.zbqibing.com/abe72af3ef39443ab191de561302e806/ffc8e6f2f6d745b3a28adda8044281a9-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "pofang":
          videoResource = "http://video.zbqibing.com/80149c1a928b412d98ee2b56255e6515/57c7497d28fd4911ba4bee506089a128-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "juedou":
          videoResource = "http://video.zbqibing.com/d88973a6b9904b1db1f27957d52181b4/f2b102df0f474a809e0372cadb549ddc-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "jingu":
          videoResource = "http://video.zbqibing.com/c03fc1bc504440e3b1860a357ec21e8f/efb4677c95b14f1ba286089ed0a595c2-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "huanshi":
          videoResource = "http://video.zbqibing.com/0059fbf63a09404fadad813bec18918b/f733aaa81c6b495da19f2b4111f3f809-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "duoyao":
          videoResource = "http://video.zbqibing.com/2f997aaaae7044039de3759856d0abbc/547892d4ac8847899518c735acfc8e56-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        case "chihuan":
          videoResource = "http://video.zbqibing.com/43f17a9e350b4e3b873421e1b35830d5/591668a53fc048c4b3f2d83f95cd46c4-bebed62c6b6ebe8977b46266f0584fdc.mp4"
          break;
        default:
        
      }
    var src = videoResource
    $('.loading').show();
    $("video")[0].play();
    launchFullScreen($("video")[0]);
    $('video')[0].oncanplay = function(){
      $('.loading').hide();
    }
    // $("video")[0].play();
    //让视频全屏自动全屏播放
    // screen.orientation.lock('landscape');
  });

      $("img.lazy").show().lazyload();
      $("img.lazy").lazyload();
      $("img.lazy").lazyload({
          threshold : $(window).height() + 2000
      });
      $("img.lazy").lazyload({
          effect : "fadeIn"
      });

if(getUrlParams(window.location.href).indexOf('from=19') >= 0){
  $('.hide').hide();

}

if(getUrlParams(window.location.href).indexOf('ad_from=19') >= 0){
  $('.hide').hide();
}


})